package com.sugar.real.estate.module.business.controller.app.apartment.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.sugar.real.estate.module.business.controller.app.info.vo.AppInfoRespVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

import static com.sugar.real.estate.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

@Schema(description = "APP - 楼盘/公寓 Response VO")
@Data
public class AppApartmentDetailRespVO {

    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "19864")
    private Long id;

    @Schema(description = "房屋名", requiredMode = Schema.RequiredMode.REQUIRED)
    private String name;
    private String nameZhCn;
    private String nameEnUs;

    @Schema(description = "房屋图片（多个逗号分隔）", requiredMode = Schema.RequiredMode.REQUIRED)
    private List<String> showImages;

    @Schema(description = "房屋视频（多个逗号分隔）", requiredMode = Schema.RequiredMode.REQUIRED)
    private List<String> showVideos;

    @Schema(description = "主力户型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private String mainHouseType;
    private String mainHouseTypeZhCn;
    private String mainHouseTypeEnUs;

    @Schema(description = "最小价格（单位：元）")
    private BigDecimal priceMin;

    @Schema(description = "最大价格（单位：元）")
    private BigDecimal priceMax;

    @Schema(description = "标签", requiredMode = Schema.RequiredMode.REQUIRED)
    private List<String> tags;
    private List<String> tagsZhCn;
    private List<String> tagsEnUs;

    @Schema(description = "亮点", requiredMode = Schema.RequiredMode.REQUIRED)
    private List<String> projectLight;
    private List<String> projectLightZhCn;
    private List<String> projectLightEnUs;

    @Schema(description = "项目类型（字典：2）", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    private String projectType;

    @Schema(description = "项目类型名", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    private String projectTypeName;

    @Schema(description = "项目进度", requiredMode = Schema.RequiredMode.REQUIRED)
    private String projectProgress;
    private String projectProgressZhCn;
    private String projectProgressEnUs;

    @Schema(description = "完工时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @JsonSerialize(using = LocalDateSerializer.class) // 序列化（响应）
    @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化（请求）
    @JsonFormat(pattern = "yyyy-MM")
    private LocalDate completionTime;

    @Schema(description = "建筑商", requiredMode = Schema.RequiredMode.REQUIRED)
    private String builder;
    private String builderZhCn;
    private String builderEnUs;

    @Schema(description = "设计师", requiredMode = Schema.RequiredMode.REQUIRED)
    private String designer;
    private String designerZhCn;
    private String designerEnUs;

    @Schema(description = "内容详情", requiredMode = Schema.RequiredMode.REQUIRED)
    private String content;
    private String contentZhCn;
    private String contentEnUs;

    @Schema(description = "坐标点", requiredMode = Schema.RequiredMode.REQUIRED)
    private String point;

    @Schema(description = "定位详情", requiredMode = Schema.RequiredMode.REQUIRED)
    private String pointDetail;

    @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @JsonSerialize(using = LocalDateTimeSerializer.class) // 序列化（响应）
    @JsonDeserialize(using = LocalDateTimeDeserializer.class) // 反序列化（请求）
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime updateTime;

    @Schema(description = "户型信息", requiredMode = Schema.RequiredMode.REQUIRED)
    private List<AppApartmentHouseTypeDetailRespVO> houseTypeList;

    @Schema(description = "销售信息", requiredMode = Schema.RequiredMode.REQUIRED)
    private List<AppApartmentSalespersonDetailRespVO> salespersonList;

    @Schema(description = "资讯信息", requiredMode = Schema.RequiredMode.REQUIRED)
    private AppInfoRespVO info;

    @Schema(description = "是否还有更多资讯", requiredMode = Schema.RequiredMode.REQUIRED)
    private Boolean haveMoreInfo = false;

    @Schema(description = "当前用户是否收藏 （false否 true是）", requiredMode = Schema.RequiredMode.REQUIRED)
    private Boolean userFollow = false;

    @Schema(description = "参考总价", requiredMode = Schema.RequiredMode.REQUIRED)
    private String totalAmount;
}